package com.tl.reggie.web;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tl.reggie.common.R;
import com.tl.reggie.pojo.Orders;
import com.tl.reggie.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrdersController {
    @Autowired
    OrdersService ordersService;

    @PostMapping("/submit")
    public R<String> submit(@RequestBody Orders orders){
        ordersService.submit(orders);
        return R.success("下单成功");
    }

    @GetMapping("/userPage")
    public R<Page> page(Integer page, Integer pageSize){
        Page<Orders> pageInfo = new Page(page, pageSize);
        ordersService.page(pageInfo);
        return R.success(pageInfo);
    }
}
